package com.hjsmallfly.syllabus.mock_lesson.main

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.support.v7.widget.Toolbar
import android.view.MenuItem
import com.hjsmallfly.syllabus.R
import com.hjsmallfly.syllabus.base.BaseKtActivity
import com.hjsmallfly.syllabus.ext.compat
import com.hjsmallfly.syllabus.ext.setBackIcon
import kotlinx.android.synthetic.main.activity_mock_lesson.*

class MockLessonActivity : BaseKtActivity(), Toolbar.OnMenuItemClickListener {

    override fun getContentView() = R.layout.activity_mock_lesson

    override fun init(savedInstanceState: Bundle?) {
        initTitle()
        initMenu()
    }

    private fun initMenu() {
        tb_title.inflateMenu(R.menu.mock_lesson)
        tb_title.setOnMenuItemClickListener(this)
    }

    private fun initTitle() {
        tb_title.compat()
        tb_title.setBackIcon()
        tb_title.setNavigationOnClickListener {
            finish()
        }
    }

    override fun onMenuItemClick(item: MenuItem?): Boolean {
        val item = item ?: return true
        when (item.itemId) {
            R.id.action_add_lesson -> {

            }
            R.id.action_lesson_list -> {

            }
        }
        return true
    }

    companion object {
        @JvmStatic
        fun newIntent(context: Context) = Intent(context, MockLessonActivity::class.java)
    }
}